// 异常处理
// middlewares/catcherror.js
const HttpExceptionError = require("./http-exception");
const catchEoore = async (ctx, next) => {
  try {
    await next();
  } catch (error) {
    if (error instanceof HttpExceptionError) {
      return (ctx.body = error);
    } else {
      return (ctx.body = error);
    }
  }
};

module.exports = catchEoore;
